//
//  CTVChannel.h
//  Channltv
//
//  Created by Bruno Keymolen on 7/5/07.
//  Copyright 2007 channl.tv. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "CTVClip.h"

@class CTVChannelWatchPoint, CTVChannel;

@interface CTVChannel : NSObject {
	@protected
		NSString* m_url; //ClipsInChannel URL
		NSString* m_name;
		NSString* m_thumbUrl;
		NSMutableArray* m_clips; //CTVClip
		NSString* m_channelID;
		BOOL m_willBeDeleted;
		id m_p_rootChannel; //A pointer to rootchannel
		CTVChannelWatchPoint* m_watchPoint;
		BRQTKitVideoPlayer* m_player;
		NSString* m_playerMediaURLString;
		BRBitmapTexture* m_thumbTexture;
	@private
	@public
}

-(id)initWithRootChannelPointer:(id)pRootChannel;
-(int)removeAllPrograms;
-(CTVClip*)createNewProgram;
-(int)count;
-(CTVClip*)GetProgramAtIndex:(int)index;
-(int)RemoveProgramAtIndex:(int)index;
-(int)RemoveProgram:(CTVClip*)program;
-(void)setUrl:(NSString*)url;
-(NSString*)url;
-(void)setName:(NSString*)name;
-(void)setThumbUrl:(NSString*)thumbUrl;
-(NSString*)name;
-(NSString*)thumbUrl;
-(void)setChannelId:(NSString*)channelID;
-(NSString*)channelID;
-(void)addProgram:(CTVClip*)prog;
-(void)setWillBeDeleted:(BOOL)flag;
-(BOOL)willBeDeleted;
-(NSArray*)clips;
-(void)setRootChannelPointer:(id)pRootChannel;
-(id)pRootChannel;
-(BRBitmapTexture*)thumbTextureForScene:(BRRenderScene*)scene;

-(void)updateWatchPointWithClip:(CTVClip*)clip;
-(void)resetWatchPoint;
-(CTVChannelWatchPoint*)watchPoint;
-(CTVClip*)nextClipToPlay;
-(CTVClip*)prevClipToPlay;
-(CTVClip*)currentClipToPlay;
-(BRQTKitVideoPlayer*)playerForMediaURLString:(NSString*)urlString;

@end



/*
 * WatchPoint
 */
@interface CTVChannelWatchPoint : NSObject {
	@private
		BOOL m_initialized;
		NSString* m_clipID;
		int m_clipIndex;
		float m_offset; //offset in seconds for clip
}
-(id)init;
-(void)dealloc;

-(void)setClipID:(NSString*)clipID;
-(void)setClipIndex:(int)clipIndex;
-(void)setOffset:(float)offset; 

-(NSString*)clipID;
-(int)clipIndex;
-(float)offset;
-(BOOL)initialized;
-(void)setInitialized:(BOOL)val;

@end